<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2011 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: luofei614 <weibo.com/luofei614>
// +----------------------------------------------------------------------
// | 修改者: anuo (本权限类在原3.2.3的基础上修改过来的)
// +----------------------------------------------------------------------

namespace third;

use esign\comm\EsignHttpHelper;
use esign\comm\EsignUtilHelper;
use esign\emun\HttpEmun;
use think\facade\Db;
use think\facade\Config;
use think\facade\Request;
use think\facade\Session;

use esign\comm\EsignLogHelper;

class Esign
{
    protected $rules = [];
    /**
     * 当前请求实例.
     *
     * @var Request
     */
    protected $request;
    protected $httpStatusCode;
    protected $error;

    //默认配置
    public $config = [
        'eSignAppId' => '7438996831', //app id
        'eSignAppSecret' => '461217d8f609dd4356a9043830c05a09', // app key
        'eSignHost' => 'https://smlopenapi.esign.cn', //模拟环境
        //     'url'=>'https://openapi.esign.cn' //正式环境
    ];

    public function __construct()
    {
        if ($auth = Config::get('auth')) {
            $this->config = array_merge($this->config, $auth);
        }
        $this->config['eSignAppId'] = env('ESIGN.eSignAppId', $this->config['eSignAppId']);
        $this->config['eSignAppSecret'] = env('ESIGN.eSignAppSecret', $this->config['eSignAppSecret']);
        $this->config['eSignHost'] = env('ESIGN.eSignHost', $this->config['eSignHost']);
        // 初始化request
        $this->request = \request();
        include(root_path() . "extend/SaaSAPI_V3/EsignOpenAPI.php");

    }


    //文件md5
    function contentMd5($filePath)
    {
        if (!file_exists($filePath)) {
            $this->error = $filePath . "文件不存在";
            return false;
        }
        return EsignUtilHelper::getContentBase64Md5($filePath);
    }

    /**
     * @param $filePath
     * @param $contentMd5
     * @return mixed
     */
    public function fileUploadUrl($filePath, $filename)
    {
        $config = $this->config;
        $apiaddr = "/v3/files/file-upload-url";
        $requestType = HttpEmun::POST;
        $data = [
            "contentMd5" => $this->contentMd5($filePath),
            "contentType" => "application/pdf",
            "convertToPDF" => false,
            "fileName" => $filename,
            "fileSize" => filesize($filePath)
        ];
        $paramStr = json_encode($data);
        //生成签名验签+json体的header

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        //获取文件上传地址

        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);

        $fileUploadUrl = json_decode($response->getBody())->data->fileUploadUrl;
        $fileId = json_decode($response->getBody())->data->fileId;
//        dump(json_decode($response->getBody()));
//       EsignLogHelper::printMsg($response->getStatus());
//       EsignLogHelper::printMsg($response->getBody());

        //文件流put上传
        $response = EsignHttpHelper::upLoadFileHttp($fileUploadUrl, $filePath, "application/pdf");
//        dump(json_decode($response->getBody()));
//        EsignLogHelper::printMsg($response->getStatus());
//        EsignLogHelper::printMsg($response->getBody());

        return $fileId;
    }


    /**
     * 获取制作合同模板页面
     * @param $fileId
     * @param $docTemplateType
     * docTemplateType 模板类型，默认值为 0 0 - PDF模板 1 - HTML模板（适用动态增加表格行并填充内容场景）
     * @return mixed
     */
    function docTemplateCreateUrl($fileId, $docTemplateName, $docTemplateType)
    {
        $config = $this->config;
        $apiaddr = "/v3/doc-templates/doc-template-create-url";
        $requestType = HttpEmun::POST;
        $data = [
            "docTemplateName" => $docTemplateName,
            "docTemplateType" => $docTemplateType,
            "fileId" => $fileId,
            "redirectUrl" => ""
        ];
        $paramStr = json_encode($data);
        //生成签名验签+json体的header

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        //发起接口请求
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
        return json_decode($response->getBody(), true);

    }


    /**
     * 获取制作合同模板编辑页面
     * @param $fileId
     * @param $docTemplateType
     * docTemplateType 模板类型，默认值为 0 0 - PDF模板 1 - HTML模板（适用动态增加表格行并填充内容场景）
     * @return mixed
     */
    function docTemplateEditUrl($docTemplateId, $redirectUrl = '')
    {
        $config = $this->config;
        $apiaddr = "/v3/doc-templates/{$docTemplateId}/doc-template-edit-url";
        $requestType = HttpEmun::POST;
        $data = [
            "docTemplateId" => $docTemplateId,
//            "docTemplateName"=>$docTemplateName,
            "redirectUrl" => $redirectUrl
        ];
        $paramStr = json_encode($data);
        //生成签名验签+json体的header

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        //发起接口请求
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
        return json_decode($response->getBody(), true);

    }


    /**
     * 获取填写合同模板页面
     */

    public function docTemplateFillUrl($docTemplateId, $notifyurl, $redirectUrl, $data)
    {


        $config = $this->config;
        $apiaddr = "/v3/doc-templates/doc-template-fill-url";
        $requestType = HttpEmun::POST;
        $data = [
            'docTemplateId' => $docTemplateId,
            'notifyUrl' => $notifyurl,
            'redirectUrl' => $redirectUrl,
            'customBizNum' => $data['customBizNum'],

        ];
        $paramStr = json_encode($data);
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);


        if ($response->getStatus() == 200) {
            $result = json_decode($response->getBody(), true);
            if ($result['code'] == 0) {
                return $result['data'];
//                EsignLogHelper::printMsg("基于文件发起签署接口调用成功，flowId: " . $flowId);
            } else {
                $this->error = "调用失败，错误信息: " . $result['message'];
                return false;
            }
        } else {
            $this->error = "调用失败，HTTP错误码" . $response->getStatus();
            return false;
        }


    }


    /**
     * 基于文件发起签署
     */
    function createByFile($fileId, $filename, $signFlowTitle, $signers, $notifyUrl, $psnInitiator_psnId)
    {

        $config = $this->config;
        $apiaddr = "/v3/sign-flow/create-by-file";
        $requestType = HttpEmun::POST;
        $signers_data = [];
        foreach ($signers as $k => $item) {
            $signers_data[] = [
                "signConfig" => [
                    'signOrder' => $k + 1
                ],
                'noticeConfig' => [
                    'noticeTypes' => $item['noticeTypes']
                ],
                "psnSignerInfo" => [
                    "psnAccount" => $item['mobile'],
                    "psnName" => $item['username']
                ],
                "signFields" => [
                    [
                        "fileId" => $fileId,
                        "signFieldType" => 0,
                        "normalSignFieldConfig" => [
                            "freeMode" => $item['freeMode'],
                            "autoSign" => false,
                            "signFieldStyle" => 1,
                            "signFieldPosition" => [
                                "positionPage" => $item['positionPage'],
                                "positionX" => $item['positionX'],
                                "positionY" => $item['positionY']
                            ]
                        ],
                        'signDateConfig' => [
//                            'dateFormat'=>'yyyy-MM-dd',
//                            'showSignDate'=>2,
                            'showSignDate' => 1,
                            'signDatePositionX' => $item['positionX'] - 40,
                            'signDatePositionY' => $item['positionY'] - 40,
                        ],
                    ]
                ],
                "signerType" => 0
            ];
        }
        $data = [
            "docs" => [
                [
                    "fileId" => $fileId,
                    "fileName" => $filename
                ]
            ],
            "signFlowConfig" => [
                "signFlowTitle" => $signFlowTitle,
                "signFlowExpireTime" => (time() + 86400) * 1000,
                "autoFinish" => true,
                "notifyUrl" => $notifyUrl,
                'redirectConfig' => [
                    'redirectUrl' => 'wechat://back',
                ]
            ],
            "signFlowInitiator" => [
                'psnInitiator' => [
                    'psnId' => $psnInitiator_psnId
                ]
            ],
            "signers" => $signers_data
        ];

//        dump($data);die;
        $paramStr = json_encode($data);
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
        $flowId = false;
        if ($response->getStatus() == 200) {
            $result = json_decode($response->getBody());
            if ($result->code == 0) {
                return $result->data->signFlowId;
//                EsignLogHelper::printMsg("基于文件发起签署接口调用成功，flowId: " . $flowId);
            } else {
                $this->error = "基于文件发起签署接口调用失败，错误信息: " . $result->message;
                return false;
            }
        } else {
            $this->error = "基于文件发起签署接口调用失败，HTTP错误码" . $response->getStatus();
            return false;
        }

    }


    /**
     * 获取合同文件签署链接
     * /v3/sign-flow/{signFlowId}/sign-url
     */
    function createByDocTemplate($docTemplateId, $fileName = '', $components = [], $requiredCheck = true)
    {

        $config = $this->config;
        $apiaddr = "/v3/files/create-by-doc-template";
        $requestType = HttpEmun::POST;
        $data = [
            "docTemplateId" => $docTemplateId,
            "fileName" => $fileName,
            "components" => $components,
            "requiredCheck" => $requiredCheck,

        ];
        $paramStr = json_encode($data);

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
        if ($response->getStatus() == 200) {
            $result = json_decode($response->getBody(), true);

//            dump($result);die;
            if ($result['code'] == 0) {
                return $result['data'];

            } else {
                $this->error = "错误信息: " . $result['message'];
                return false;
            }

        } else {
            $this->error = "获取合同文件签署链接接口调用失败，HTTP错误码" . $response->getStatus();
            return false;

        }

    }


    /**
     * 获取合同文件签署链接
     * /v3/sign-flow/{signFlowId}/sign-url
     */
    function getSignUrl($flowId, $mobile)
    {


        $config = $this->config;

        $apiaddr = "/v3/sign-flow/%s/sign-url";
        $apiaddr = sprintf($apiaddr, $flowId);
        $requestType = HttpEmun::POST;
        $data = [
            "clientType" => "H5",
            "needLogin" => false,
            "operator" => [
                "psnAccount" => $mobile
            ],
            "urlType" => 2
        ];
        $paramStr = json_encode($data);

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);

//        EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
//        EsignLogHelper::printMsg($response->getStatus());
//        EsignLogHelper::printMsg($response->getBody());
        $url = null;
        if ($response->getStatus() == 200) {

            $result = json_decode($response->getBody());

            if ($result->code == 0) {
                return $result->data;

            } else {
                $this->error = "错误信息: " . $result->message;
                return false;
            }

        } else {
            $this->error = "获取合同文件签署链接接口调用失败，HTTP错误码" . $response->getStatus();
            return false;

        }

    }


    /**
     * 查询文件状态
     * @param $fileId
     * @return mixed
     */
    function fileDownloadUrl($signFlowId)
    {
        $config = $this->config;

        $apiaddr = "/v3/sign-flow/%s/file-download-url";
        $apiaddr = sprintf($apiaddr, $signFlowId);
        $requestType = HttpEmun::GET;
        //生成签名验签+json体的header
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], "", $requestType, $apiaddr);
        //发起接口请求
//        EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, "");
        $response = json_decode($response->getBody(), true);
        //返回2  表示已经成功
        return $response;
    }


    /**
     *  撤销签署流程
     *   /v3/sign-flow/{signFlowId}/revoke
     */
    function revokeFlow($flowId)
    {
        $config = $this->config;

        $apiaddr = "/v3/sign-flow/%s/revoke";
        $apiaddr = sprintf($apiaddr, $flowId);
        $requestType = HttpEmun::POST;
        $paramStr = null;
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);

        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);

        if ($response->getStatus() == 200) {

            $result = json_decode($response->getBody(), true);
            return $result;
        } else {
            $this->error = "获取合同文件签署链接接口调用失败，HTTP错误码" . $response->getStatus();
            return false;
        }

    }


    //申请出证
    function evidence_report_apply($flowId, $notifyUrl)
    {

        $config = $this->config;
        $apiaddr = "/v3/evidence-report/apply";
        $requestType = HttpEmun::POST;
        $data = [
            "signFlowId" => $flowId,
            "notifyUrl" => $notifyUrl,

        ];
        $paramStr = json_encode($data);

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);

//        EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
//        EsignLogHelper::printMsg($response->getStatus());
//        EsignLogHelper::printMsg($response->getBody());
        $url = null;
        if ($response->getStatus() == 200) {

            $result = json_decode($response->getBody());

            dump($result);
            if ($result->code == 0) {
                return $result->data;

            } else {
                $this->error = "申请出证错误信息: " . $result->message;
                return false;
            }

        } else {
            $this->error = "申请出证接口调用失败，HTTP错误码" . $response->getStatus();
            return false;

        }


    }


    //获取区块链存证信息
    function antchain_file_info($flowId)
    {

        $config = $this->config;
        $apiaddr = "/v3/antchain-file-info";
        $requestType = HttpEmun::POST;
        $data = [
            "signFlowId" => $flowId,

        ];
        $paramStr = json_encode($data);

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);

//        EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
//        EsignLogHelper::printMsg($response->getStatus());
//        EsignLogHelper::printMsg($response->getBody());
        $url = null;
        if ($response->getStatus() == 200) {

            $result = json_decode($response->getBody(), true);

            if ($result['code'] == 0) {
                return $result['data'];

            } else {
                $this->error = "申请出证错误信息: " . $result['message'];
                return false;
            }

        } else {
            $this->error = "申请出证接口调用失败，HTTP错误码" . $response->getStatus();
            return false;

        }


    }


    /**
     * 查询文件状态
     * @param $fileId
     * @return mixed
     */
    function templatesList($page)
    {
        $config = $this->config;

        $apiaddr = "/v3/doc-templates?pageNum={$page}&pageSize=20";
        $requestType = HttpEmun::GET;
        //生成签名验签+json体的header
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], "", $requestType, $apiaddr);
        //发起接口请求
//        EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, "");
        $response = json_decode($response->getBody(), true);
        //返回2  表示已经成功
        return $response;
    }


    /**
     * 查询合同模板中控件详情
     * @param $fileId
     * @return mixed
     */
    function templatesComponents($docTemplateId)
    {
        $config = $this->config;

        $apiaddr = "/v3/doc-templates/{$docTemplateId}";
        $requestType = HttpEmun::GET;
        //生成签名验签+json体的header
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], "", $requestType, $apiaddr);
        //发起接口请求
//        EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, "");
        $response = json_decode($response->getBody(), true);
        //返回2  表示已经成功
        return $response;
    }


    /**
     * 查询文件状态
     * @param $fileId
     * @return mixed
     */
    function fileStatues($fileId)
    {
        $config = $this->config;

        $apiaddr = "/v3/files/" . $fileId;
        $requestType = HttpEmun::GET;
        //生成签名验签+json体的header
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], "", $requestType, $apiaddr);
        //发起接口请求
//        EsignLogHelper::printMsg($signAndBuildSignAndJsonHeader);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, "");
        $fileStatus = $fileId = json_decode($response->getBody())->data->fileStatus;
//        dump(json_decode($response->getBody(), true));
        //返回2  表示已经成功
        return $fileStatus;
    }


    /**
     * 发起个人实名
     * @param $psnAccount
     */
    function psnAuthUrl($psnAccount, $redirectUrl, $notifyUrl)
    {
        $config = $this->config;
        $apiaddr = "/v3/psn-auth-url";
        $requestType = HttpEmun::POST;
        $data = [
            "psnAuthConfig" => [
                "psnAccount" => $psnAccount,
//                "psnInfo" => [
//                    "psnName" => ""
//                ]
            ],
            "redirectConfig" => [
                "redirectUrl" => $redirectUrl
            ],
            "notifyUrl" => $notifyUrl,
            "clientType" => "ALL",
            "appScheme" => ""
        ];

//        dump($data);
        $paramStr = json_encode($data);
        //生成签名验签+json体的header
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        //发起接口请求
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
        $this->httpStatusCode = $response->getStatus();
        $data = json_decode($response->getBody(), true);
        return $data;
    }

    /**
     * 发起个人授权
     * @param $psnAccount
     */
    function psnAuthorizehUrl($psnAccount, $redirectUrl, $notifyUrl)
    {
        $config = $this->config;
        $apiaddr = "/v3/psn-auth-url";
        $requestType = HttpEmun::POST;
        $data = [
            "psnAuthConfig" => [
                "psnAccount" => $psnAccount,
                "psnInfo" => [
                    "psnName" => ""
                ]
            ],
            "authorizeConfig" => [
                "authorizedScopes" => ["get_psn_identity_info", "psn_initiate_sign", "manage_psn_resource"]
            ],
            "redirectConfig" => [
                "redirectUrl" => $redirectUrl
            ],
            "notifyUrl" => $notifyUrl,
            "clientType" => "ALL",
            "appScheme" => ""
        ];
        $paramStr = json_encode($data);
        //生成签名验签+json体的header

//        dump($data);die;

        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], $paramStr, $requestType, $apiaddr);
        //发起接口请求
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, $paramStr);
        $this->httpStatusCode = $response->getStatus();
        $data = json_decode($response->getBody(), true);
        return $data;

    }


    /**
     * 查询个人认证信息
     * @param $psnId
     * @param $scence
     * @return mixed
     */
    function personsIdentityInfo($psnId)
    {
        $config = $this->config;
        $apiaddr = "/v3/persons/identity-info?psnId=" . $psnId;
        $requestType = HttpEmun::GET;
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], "", $requestType, $apiaddr);
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, "");
        $this->httpStatusCode = $response->getStatus();
        $data = json_decode($response->getBody(), true);
        return $data;
    }

    /**
     * 查询个人授权信息
     * @param $psnId
     * @return \esign\comm\EsignResponse
     */
    function personsAuthorizedInfo($psnId)
    {
        $config = $this->config;
        $apiaddr = "/v3/persons/{$psnId}/authorized-info";
        $requestType = HttpEmun::GET;
        $signAndBuildSignAndJsonHeader = EsignHttpHelper::signAndBuildSignAndJsonHeader($config['eSignAppId'], $config['eSignAppSecret'], "", $requestType, $apiaddr);
        //发起接口请求
        $response = EsignHttpHelper::doCommHttp($config['eSignHost'], $apiaddr, $requestType, $signAndBuildSignAndJsonHeader, "");
        $this->httpStatusCode = $response->getStatus();
        $data = json_decode($response->getBody(), true);
        return $data;
    }


    /**
     * 获取请求码
     * @return mixed
     */
    public function gethttpStatusCode()
    {
        return $this->httpStatusCode;
    }

    public function getError()
    {
        return $this->error;
    }


}
